package com.lanou.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lanou.entity.Banner;
import com.lanou.mapper.BannerMapper;
import com.lanou.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName BannerServiceImpl
 * @Description TODO
 * @Author lizhenjiang
 * @Date 2025年08月15日 17:42
 * @Version 1.0
 */
@Service
public class BannerServiceImpl implements BannerService {
    @Autowired
    private BannerMapper bannerMapper;


    @Override
    public PageInfo<Banner> findBanners(Integer pageNum, Integer pageSize) {
        if (pageNum != null && pageSize != null) {
            PageHelper.startPage(pageNum, pageSize);
        }

        List<Banner> banners = bannerMapper.selectBanner();
        PageInfo<Banner> pageInfo = new PageInfo<>(banners);
        return pageInfo;
    }
}
